<!DOCTYPE html>
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Cache-Control"  content="no-transform">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>手机号绑定</title>
    <link href="/statics/view/css/yy_common.css" rel="stylesheet">
    <link href="/statics/view/css/yy_login.css" rel="stylesheet">
<body>
<div class="m-simpleHeader" id="dvHeader">
    <a href="javascript:void(0);" data-pro="back" data-back="true" class="m-simpleHeader-back"><i class="ico ico-back"></i></a>
    <h1>手机号绑定1</h1>
</div>
<div class="m-login">
    <form action="/bind/bind-mobile-validate" method="post" id="mobileBind">
    <div class="m-login-tips" id="tips"></div>
    <div class="m-login-form w-form">
        <div class="w-form-item m-login-form-account w-inputBar w-bar" id="dvAccount"><div class="w-bar-label">手机号：</div><a data-pro="clear" href="javascript:void(0);" class="w-bar-input-clear">×</a><div class="w-bar-control"><input placeholder="手机号" autocapitalize="off" data-pro="input" class="w-bar-input" type="text" name="mobile" value=""></div></div>
        <div class="w-form-item m-login-form-password w-inputBar w-bar" id="dvPassword"><div class="w-bar-label">密码：</div><a data-pro="clear" href="javascript:void(0);" class="w-bar-input-clear">×</a><div class="w-bar-control"><input placeholder="验证码" autocapitalize="off" data-pro="input" class="w-bar-input" type="text" name="smsCode" value=""></div></div>
        <div class="m-login-menu" id="autoCmpl" style="display:none;"></div>
    </div>
    <div class="m-login-tips-bottom" id="tipsBottom" afmoldstyle="block" style="display: none;"></div>
    <div class="m-login-submit"><button class="w-button w-button-main" onclick="javascript:$('#mobileBind').submit();">确定绑定</button></div>
    </form>
</div>
<script src="/statics/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/statics/view/js/jquery.validate.js"></script>
<script type="text/javascript" src="/statics/layer.m/layer.m.js"></script>
<script type="text/javascript">
    $().ready(function() {
        var $mobileBind = $("#mobileBind");
        var $mobile = $("input[name='mobile']");
        var $smsCode = $("input[name='smsCode']");
        $mobileBind.validate({
            rules: {
                mobile: "required",
                smsCode: "required"
            },
            submitHandler: function(form) {
                layer.open({
                    type: 2,
                    content: '提交中~'
                });
                $.ajax({
                    url: $mobileBind.attr("action"),
                    type: "POST",
                    data: {
                        username: $mobile.val(),
                        smsCode : $smsCode.val()
                    },
                    dataType: "json",
                    cache: false,
                    success: function(message) {
                        layer.closeAll();
                        if (message.type == "success") {
                        [#if redirectUrl??]
                            location.href = "${redirectUrl}";
                        [#else]
                            location.href = "/";
                        [/#if]
                        } else {
                            layer.open({
                                content: message.content,
                                time: 2
                            });
                        }
                    },error:function(){
                        layer.closeAll();
                        layer.open({
                            content: "服务器异常",
                            time: 2
                        });
                    }
                });
            }
        });
    });
</script>
</body>
</html>